﻿--
-- Dropping stored procedure pr_ChiTietHoaDonBanHang_SelectAll : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietHoaDonBanHang_SelectAll]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietHoaDonBanHang_SelectAll]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietHoaDonBanHang_SelectAll
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:54 PM
-- Description:	This stored procedure is intended for selecting all rows from ChiTietHoaDonBanHang table
-- ==========================================================================================
Create Procedure pr_ChiTietHoaDonBanHang_SelectAll
As
Begin
	Select 
		[MaHD],
		[MaHH],
		[SoLuong],
		[DonGia],
		[ThanhTien]
	From ChiTietHoaDonBanHang
End

GO


--
-- Dropping stored procedure pr_ChiTietHoaDonBanHang_SelectRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietHoaDonBanHang_SelectRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietHoaDonBanHang_SelectRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietHoaDonBanHang_SelectRow
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:54 PM
-- Description:	This stored procedure is intended for selecting a specific row from ChiTietHoaDonBanHang table
-- ==========================================================================================
Create Procedure pr_ChiTietHoaDonBanHang_SelectRow
	@MaHD varchar(10),
	@MaHH varchar(10)
As
Begin
	Select 
		[MaHD],
		[MaHH],
		[SoLuong],
		[DonGia],
		[ThanhTien]
	From ChiTietHoaDonBanHang
	Where
		[MaHD] = @MaHD
		and [MaHH] = @MaHH
End

GO


--
-- Dropping stored procedure pr_ChiTietHoaDonBanHang_Insert : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietHoaDonBanHang_Insert]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietHoaDonBanHang_Insert]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietHoaDonBanHang_Insert
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:54 PM
-- Description:	This stored procedure is intended for inserting values to ChiTietHoaDonBanHang table
-- ==========================================================================================
Create Procedure pr_ChiTietHoaDonBanHang_Insert
	@MaHD varchar(10),
	@MaHH varchar(10),
	@SoLuong int,
	@DonGia decimal,
	@ThanhTien decimal
As
Begin
	Insert Into ChiTietHoaDonBanHang
		([MaHD],[MaHH],[SoLuong],[DonGia],[ThanhTien])
	Values
		(@MaHD,@MaHH,@SoLuong,@DonGia,@ThanhTien)

End

GO


--
-- Dropping stored procedure pr_ChiTietHoaDonBanHang_Update : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietHoaDonBanHang_Update]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietHoaDonBanHang_Update]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietHoaDonBanHang_Update
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:54 PM
-- Description:	This stored procedure is intended for updating ChiTietHoaDonBanHang table
-- ==========================================================================================
Create Procedure pr_ChiTietHoaDonBanHang_Update
	@MaHD varchar(10),
	@MaHH varchar(10),
	@SoLuong int,
	@DonGia decimal,
	@ThanhTien decimal
As
Begin
	Update ChiTietHoaDonBanHang
	Set
		[SoLuong] = @SoLuong,
		[DonGia] = @DonGia,
		[ThanhTien] = @ThanhTien
	Where		
		[MaHD] = @MaHD
		and [MaHH] = @MaHH

End

GO


--
-- Dropping stored procedure pr_ChiTietHoaDonBanHang_DeleteRow : 
--

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[pr_ChiTietHoaDonBanHang_DeleteRow]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
  DROP PROCEDURE [dbo].[pr_ChiTietHoaDonBanHang_DeleteRow]
  
GO

-- ==========================================================================================
-- Entity Name:	pr_ChiTietHoaDonBanHang_DeleteRow
-- Author:	MinhNN
-- Create date:	5/14/2012 9:57:54 PM
-- Description:	This stored procedure is intended for deleting a specific row from ChiTietHoaDonBanHang table
-- ==========================================================================================
Create Procedure pr_ChiTietHoaDonBanHang_DeleteRow
	@MaHD varchar(10),
	@MaHH varchar(10)
As
Begin
	Delete ChiTietHoaDonBanHang
	Where
		[MaHD] = @MaHD
		and [MaHH] = @MaHH

End

GO
